# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=melonds
pkgver=0.9.5
pkgrel=2
pkgdesc="Nintendo DS Emulator"
url="https://melonds.kuribo64.net/"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	cmake
	extra-cmake-modules
	libarchive-dev
	libepoxy-dev
	libslirp-dev
	qt6-qtbase-dev
	qt6-qtmultimedia-dev
	samurai
	sdl2-dev
	wayland-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/Arisotura/melonDS/archive/$pkgver.tar.gz
	0000-remove-failing-assertion-x86.patch
	gcc12.patch
	"
options="!check" # No test suite
builddir="$srcdir/melonDS-$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DUSE_QT6=ON \
		$CMAKE_CROSSOPTS
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
115cf04e4e22a20016ac4f2946aef917e5c9566b1a5f18599f7b7c47b0ac71e3645157a8a21622ab83683848c57ab25e6d6fcff0df559087b56642d99ffe40ec  melonds-0.9.5.tar.gz
d5cabf1dfc3932bae2b939b4f87efd1caf14499d98f324f9013bd3e7ff33656e676c32d92ed912137a68f5e48163082472d722113d2957080174b187be52940f  0000-remove-failing-assertion-x86.patch
d85d6e2f8f4651d04db7f456a9951f712c8f66492b1938f00483b924c2371bf5794ee1071d687cc932fd0190d2a877fc009a7fc477c3cb5728983dff09413e3b  gcc12.patch
"
